package com.runa.persistence.config;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Component
@Configuration
public class CommConfig {

    /**
     * 目前只有KLMY(克拉玛依) 需要配置为KLMY
     */
    @Getter
    private static String projectAddress;

    public static boolean isTaiYuan() {
        return "太原".equals(projectAddress);
    }

    @Value("${projectAddress}")
    public void setProjectAddress(String projectAddress) {
        CommConfig.projectAddress = projectAddress;
    }

    @Getter
    private boolean readNodeBatchMeter;

    @Value("${read.node.batch.meter:true}")
    public void setReadNodeBatchMeter(boolean readNodeBatchMeter) {
        this.readNodeBatchMeter = readNodeBatchMeter;
    }

    @Getter
    private boolean readNodeBatchValve;

    @Value("${read.node.batch.valve:true}")
    public void setReadNodeBatchValve(boolean readNodeBatchValve) {
        this.readNodeBatchValve = readNodeBatchValve;
    }

    @Getter
    private boolean readNodeBatchPanel;

    @Value("${read.node.batch.panel:true}")
    public void setReadNodeBatchPanel(boolean readNodeBatchPanel) {
        this.readNodeBatchPanel = readNodeBatchPanel;
    }

    public void setToken(String token) {
        CommConfig.token = token;
    }

    @Getter
    private String url;

    @Getter
    private static String token;

    @Value("${lchr.url:xxx:xxx/rtms/api/lastreportdata}")
    public void setUrl(String url) {
        this.url = url;
    }

    @Value("${lchr.token:xxx}")
    public void setPassWord(String token) {
        CommConfig.token = token;
    }

    @Getter
    private static String tfUrl;

    @Getter
    private static String tfUsername;

    @Getter
    private static String tfPassword;

    @Value("${tfnb.url:}")
    public void setTfUrl(String tfUrl) {
        CommConfig.tfUrl = tfUrl;
    }

    @Value("${tfnb.tfUsername:}")
    public void setTfUsername(String tfUsername) {
        CommConfig.tfUsername = tfUsername;
    }

    @Value("${tfnb.tfPassword:}")
    public void setTfPassword(String tfPassword) {
        CommConfig.tfPassword = tfPassword;
    }



    @Getter
    private static String badUrl;

    @Getter
    private static String badUsername;

    @Getter
    private static String badPassword;

    @Value("${blackAntDB.url:}")
    public void setBadUrl(String badUrl) {
        CommConfig.badUrl = badUrl;
    }

    @Value("${blackAntDB.username:}")
    public void setBadUsername(String badUsername) {
        CommConfig.badUsername = badUsername;
    }

    @Value("${blackAntDB.password:}")
    public void setBadPassword(String badPassword) {
        CommConfig.badPassword = badPassword;
    }

    @Getter
    private static String baUrl;

    @Getter
    private static String baUsername;

    @Getter
    private static String baPassword;

    @Value("${blackAnt.url:}")
    public void setBaUrl(String baUrl) {
        CommConfig.baUrl = baUrl;
    }

    @Value("${blackAnt.username:}")
    public void setBaUsername(String baUsername) {
        CommConfig.baUsername = baUsername;
    }

    @Value("${blackAnt.password:}")
    public void setBaPassword(String baPassword) {
        CommConfig.baPassword = baPassword;
    }
}
